feat(agent): expose active package policy - #1937
feat(agent): expose active package policy#1937Benoît Cortier (CBenoit) wants to merge 11 commits into
Conversation
Expose the validated active package-broker policy through the shared authenticated GET /v1/policy route. Return a structured unavailable error without leaking policy source or file-security details. This requires now-policy-api and now-policy-server-template 0.4.0 from Devolutions/now-libraries#93 before the change can ship. Issue: Devolutions/now-libraries#93 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
|
Implementation notes:
Validated against frozen shared commit Commands and results: The draft remains blocked until Note LLM-assisted content (no human feedback). |
There was a problem hiding this comment.
Pull request overview
Adds authenticated active-policy inspection to the Agent’s package broker.
Changes:
- Implements
GET /v1/policywith structured responses. - Reuses connection authentication and adds snapshot/concurrency tests.
- Remains blocked on publishing and committing the 0.4.0 dependencies.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
crates/now-package-broker/src/server/mod.rs |
Implements and tests policy retrieval. |
crates/now-package-broker/src/auth.rs |
Exposes connection-level authentication for the endpoint. |
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Return a generic policy-unavailable message so clients cannot infer whether the active policy is file-backed, missing, or corrupt. Issue: Devolutions/now-libraries#93 Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Adopt the final shared server trait and keep policy-domain conversions owned by the broker after the compatibility feature removal. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Record the registry graph after removing the obsolete policy compatibility features so locked CI can resolve the manifest consistently. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Exercise the policy HTTP contract from the repository integration tests while keeping authentication and snapshot-locking invariants beside the broker implementation. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Launch the Agent through its CLI and issue HTTP requests over a real Tokio named-pipe client. Build the test Agent with the development signature bypass while requiring the matching debug configuration opt-in. Remove the in-process broker test harness and its testsuite dependencies; retain authentication and snapshot-locking invariants as broker unit tests. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Move privileged policy endpoint coverage into a dedicated tester so the active-policy path cannot silently skip in normal test runs. Run it as LocalSystem in CI with a development-only signature bypass. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Exposes the validated active package-broker policy through the shared authenticated
GET /v1/policyroute. Clients receive a stable policy snapshot, while unavailable policies return a structured 503 response without leaking policy source or file-security details.Coordinated Phase 1 pull requests: Devolutions/now-libraries#93 defines the shared contract, Devolutions/devolutions-gateway#1937 implements the Agent endpoint, and Devolutions/UniGetUI#5292 consumes it.
The Agent implementation was integrated against exact shared contract head
032a8f2376bf4ef32e94f04fe672651dd22227a3using a temporary external Cargo patch fornow-policy,now-policy-api, andnow-policy-server-template. It implements the requiredactive_policytrait method and keeps policy/API enum and identifier mappings explicit in the broker after removal of the sharedpolicy-compatconversions. No local paths, git dependencies, or temporary sources are committed.Focused server tests passed (22/22), focused evaluator tests passed (25/25), broker Clippy passed with warnings denied, and the Devolutions Agent build passed. The full broker run passed 253 tests with 1 ignored before the pre-existing host-specific
winget_app_exec_alias_passes_elevated_verificationtest rejected the local WindowsAppswinget.exeDACL because it grants the current user write access.Commit
ab7591b5a8efe00c9a084d295cbbeda95fea1a57applies a registry-onlyCargo.lockcorrection after removal ofpolicy-compat: it removes the two obsolete optionalnow-policydependency edges socargo metadata --lockedand Linux locked jobs can resolve the tracked manifest. This lockfile correction contains no local path sources and is separate from the expected Windows compile blocker against the published 0.3.x crates.This draft remains blocked until
now-policy-api0.4.0 andnow-policy-server-template0.4.0 are published and the final registry versions are available. Do not replace that publication gate with local or git dependencies.Issue: Devolutions/now-libraries#93
Co-authored-by: Copilot App 223556219+Copilot@users.noreply.github.com